home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Glitch Apple Disk Collection
/
2014.glitch.apple.collection.zip
/
indexed
/
TWRHANOI.DSK
/
TOWERS OF HANOI.int
< prev
Wrap
Text File
|
2014-09-09
|
4KB
|
91 lines
0 REM ORIGINATED BY DANIEL A LAMBERT, SEP 5 1977, TELE: 213-343-5667
10 TEXT :CALL -936
20 VTAB 6:TAB 12: POKE 50,63:PRINT "TOWERS OF HANOI": POKE 50,255
30 DIM D1(9),D2(9),D3(9),A$(20):W2=0:W3=0:M=0
40 FOR I=0 TO 8:D1(I)=I*2+1:D2(I)=1:D3(I)=1:NEXT I:REM INITIALIZE
50 PRINT :PRINT "HI THERE, PLEASE TYPE IN YOUR NAME--":PRINT :INPUT A$:PRINT
60 PRINT "THIS TOWER OF HANOI SOLITAIRE GAME"
70 PRINT "CONSISTS OF MOVING ALL THE DISKS"
80 PRINT "FROM POST ONE TO TWO OR THREE WITHOUT"
90 PRINT "EVER PUTTING A BIG ONE ON A SMALLER ONE"
100 FOR N=1 TO 6000:NEXT N
110 GOTO 7000
200 J= PEEK (-16384):IF J<128 THEN 200: POKE -16368,0:J=J-176:PRINT :RETURN
300 PRINT "FROM WHICH POST? 1-2-OR-3? ";A$;
310 GOSUB 200:P1=J
320 IF P1=1 THEN 1000
330 IF P1=2 THEN 2000
340 IF P1=3 THEN 3000
350 PRINT "POST ";P1;" ARE YOU KIDING?"
360 PRINT :PRINT "<CTRL-G>":GOTO 300
400 A=K-LS/2:B=K+LS/2:COLOR= 0:HLIN A,B AT J:HLIN A,B AT J+1:COLOR= 12:VLIN J,J+1 AT K
410 PRINT "TO WHERE? 1--2--OR--3?";
420 GOSUB 200:P2=J
430 IF P1=P2 THEN M=M-1
440 IF P2=1 THEN 4000
450 IF P2=2 THEN 5000
460 IF P2=3 THEN 6000
470 PRINT "POST ";P2;" YOU MUST BE JOKING!"
480 PRINT :PRINT "<CTRL-G>":GOTO 410
500 PRINT "<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>"
510 PRINT "BIG DISK ON A SMALL ONE IS A NO NO!"
520 PRINT :PRINT :GOTO 410
600 IF W2*W3=0 AND W2+W3=J THEN 640
610 GOTO 7570
620 IF W2*W3=0 AND W2+W3=8 THEN 670
630 GOTO 7570
640 PRINT "<CTRL-G>";"<CTRL-G>";"<CTRL-G>"
650 PRINT "WOW! SO FAR SO GOOD, YOU MADE IT IN MIN. AMT.OF ";M;" MOVES ";A$
660 PRINT "PLEASE CONTINUE ";A$:GOTO 300
670 PRINT "CONGRATULATIONS---YOU WIN ";A$
680 PRINT "<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>";"<CTRL-G>";
690 END
1000 FOR S=0 TO 8:IF D1(S)>1 THEN 1500
1010 NEXT S
1020 IF D1(8)=1 THEN PRINT " NO DISK ON POST ONE --DUMMY--"
1030 PRINT "<CTRL-G><CTRL-G>":GOTO 300
1500 LS=D1(S):D1(S)=1:J=S*2:K=9:GOTO 400
2000 FOR S=0 TO 8:IF D2(S)>1 THEN 2500
2010 NEXT S
2020 IF D2(8)=1 THEN PRINT " NO DISK ON POST TWO --DUMMY--"
2030 PRINT "<CTRL-G><CTRL-G>":GOTO 300
2500 LS=D2(S):D2(S)=1:J=S*2+18:K=20:W2=W2-1:GOTO 400
3000 FOR S=0 TO 8:IF D3(S)>1 THEN 3500
3010 NEXT S
3020 IF D3(8)=1 THEN PRINT " NO DISK ON POST THREE --DUMMY--"
3030 PRINT "<CTRL-G><CTRL-G>":GOTO 300
3500 LS=D3(S):D3(S)=1:J=S*2:K=31:W3=W3-1:GOTO 400
4000 FOR S=0 TO 8:IF D1(S)<=1 THEN NEXT S
4500 IF D1(S)>2 AND LS>D1(S) THEN 500
4510 S=S-1:D1(S)=LS:A=9-LS/2:B=9+LS/2
4520 J=S*2:GOTO 7500
5000 FOR S=0 TO 8:IF D2(S)<=1 THEN NEXT S
5500 IF D2(S)>2 AND LS>D2(S) THEN 500
5510 S=S-1:D2(S)=LS:A=20-LS/2:B=20+LS/2
5520 W2=W2+1:J=S*2+18:GOTO 7500
6000 FOR S=0 TO 8:IF D3(S)<=1 THEN NEXT S
6500 IF D3(S)>2 AND LS>D3(S) THEN 500
6510 S=S-1:D3(S)=LS:A=31-LS/2:B=31+LS/2
6520 W3=W3+1:J=S*2:GOTO 7500
7000 GR :COLOR= 12:LS=0:VLIN 0,18 AT 9:VLIN 0,18 AT 31:VLIN 18,36 AT 20
7010 HLIN 8,10 AT 18:HLIN 30,32 AT 18:HLIN 19,21 AT 36
7020 VLIN 0,4 AT 3:PLOT 2,1:PLOT 2,4:PLOT 4,4
7030 FOR I=0 TO 4 STEP 2:HLIN 24,26 AT I:HLIN 12,14 AT I+19:NEXT I
7040 PLOT 26,1:PLOT 26,3
7050 PLOT 14,20:PLOT 12,22
7060 FOR S=0 TO 8:COLOR= S+1:J=D1(S)/2
7070 HLIN 9-J,9+J AT S*2
7080 HLIN 9-J,9+J AT S*2+1
7090 NEXT S
7100 COLOR= 12:PLOT 9,0:PLOT 9,1:GOTO 300
7500 COLOR= (LS+1)/2:HLIN A,B AT J:HLIN A,B AT J+1
7510 M=M+1
7520 FOR J=3 TO 7:IF M=2^J-1 THEN 600
7530 NEXT J
7540 IF M=255 THEN 620
7550 PRINT "SO FAR YOU MADE ";M;" MOVES ";A$
7560 PRINT :PRINT :GOTO 300
7570 PRINT "YOU DID NOT MAKE IT IN THE MIN. AMT. OF MOVES ";A$
7580 PRINT "I SUGEST YOU START OVER ";A$
7590 PRINT "<CTRL-G>";"<CTRL-G>";:GOTO 300